package cn.yunhe.entity.impl;

import cn.yunhe.entity.Bx;
import cn.yunhe.excep.OutOfNumException;
import lombok.Data;
import org.springframework.stereotype.Component;


@Data
@Component
public class BingXiang implements Bx {
    private int k = 1;//库存

    public void saleBX(int num) throws OutOfNumException {
        if (num > k) {
            throw new OutOfNumException("库存不足");
        }  else
            System.out.println("特价冰箱售出1台");
        k--;

    }
}
